//
//  MyContentModel.swift
//  OnceNectar
//
//  Created by Zhang Dream on 2018/6/24.
//  Copyright © 2018年 com.inwhoop. All rights reserved.
//

import Foundation
import MappingAce
import SwiftyJSON
struct MyContentModel:Mapping {
    
    var id : String?
    var title :String?
    var coverImgJointId :String?
    var status :String?
    var statusDesc :String?
    var delFlag :String?
    var circle :String?
    var publishTime :String?
    var auditUserId :String?
    var auditUserName :String?
    var auditTime :String?
    var denyReason :String?
    var coverImgPath :String?
    var image :String?
    var labels : [InterestMarkModel]?
    var favorite :String?
    var browse :String?
    var comment :String?
    var collected :String?
    var redirectType :String?
    var content :String?
    var shareUrl :String?
    var contentUrl :String?
    
    var label:InterestMarkModel?
    var author:AuthorModel?
    var channel:ChannelModel?
}



extension MyContentModel{
    mutating func initLabel(dic: [String:Any]) {
        label = InterestMarkModel(fromDic: dic)
    }
    mutating func initAuthor(dic: [String:Any]) {
        author = AuthorModel(fromDic: dic)
    }
    mutating func initChannel(dic: [String:Any]) {
        channel = ChannelModel(fromDic: dic)
    }
    mutating func initLabels(arr: [JSON]) {
        
        var xlabers :[InterestMarkModel] = []
        for object in arr {
            
            let xmodel = InterestMarkModel(fromDic: object.dictionary! )
            
            xlabers.append(xmodel)
        }
        labels = xlabers
    }
}
